<?php
if ($_SERVER['SERVER_PORT']!=443) {
	$sslport=443; //whatever your ssl port is
	$url = "https://". $_SERVER['SERVER_NAME'] . ":" . $sslport . $_SERVER['REQUEST_URI'];
	header("Location: $url");
}
$ini = ini_set("soap.wsdl_cache_enabled", 0);
if(!isset($_COOKIE['MySession'])){
	$url = "https://". $_SERVER['SERVER_NAME'] . "/freeway/custom/webservices/index.php?service=Session";
	$Client = new SoapClient($url);
	$Client->sessionStart();
	$this_Session = $Client->returnSID();
	setcookie('MySession', $this_Session);
	unset($Client);	
}
else 
	$this_Session = $_COOKIE['MySession'];
	
//  Simple Funciton that returns a string containing a 
//  select box with each of the 50 US states and a default value "Select State" 
//  You can pass in a state name as a string to select a specific State.  i.e. StateSelect('Virginia');
function StateSelect($selected = 'Select State'){
	$state['default'] = 'Select State';
	$state[AL] = "Alabama";
	$state[AK] = "Alaska";
	$state[AZ] = "Arizona";
	$state[AR] = "Arkansas";
	$state[CA] = "California";
	$state[CO] = "Colorado";
	$state[CT] = "Connecticut";
	$state[DE] = "Delaware";
	$state[FL] = "Florida";
	$state[GA] = "Georgia";
	$state[HI] = "Hawaii";
	$state[ID] = "Idaho";
	$state[IL] = "Illinois";
	$state[IN] = "Indiana";
	$state[IA] = "Iowa";
	$state[KS] = "Kansas";
	$state[KY] = "Kentucky";
	$state[LA] = "Louisiana";
	$state[ME] = "Maine";
	$state[MD] = "Maryland";
	$state[MA] = "Massachusetts";
	$state[MI] = "Michigan";
	$state[MN] = "Minnesota";
	$state[MS] = "Mississippi";
	$state[MO] = "Missouri";
	$state[MT] = "Montana";
	$state[NE] = "Nebraska";
	$state[NV] = "Nevada";
	$state[NH] = "New Hampshire";
	$state[NJ] = "New Jersey";
	$state[NM] = "New Mexico";
	$state[NY] = "New York";
	$state[NC] = "North Carolina";
	$state[ND] = "North Dakota";
	$state[OH] = "Ohio";
	$state[OK] = "Oklahoma";
	$state['OR'] = "Oregon";
	$state[PA] = "Pennsylvania";
	$state[RI] = "Rhode Island";
	$state[SC] = "South Carolina";
	$state[SD] = "South Dakota";
	$state[TN] = "Tennessee";
	$state[TX] = "Texas";
	$state[UT] = "Utah";
	$state[VT] = "Vermont";
	$state[VA] = "Virginia";
	$state[WA] = "Washington";
	$state[WV] = "West Virginia";
	$state[WI] = "Wisconsin";
	$state[WY] = "Wyoming";
	$options = '';
	foreach ($state as $value => $display)
		$options .= $display == $selected ? "\t\t<option value=\"$value\" selected>$display</option>" . PHP_EOL  
														  :	"\t\t<option value=\"$value\">$display</option>" . PHP_EOL;		
	unset($state);
	$stateSelect = "\t<select name=\"state\" size=\"1\">".PHP_EOL . $options . "\t</select>" . PHP_EOL;
	return $stateSelect;
}
	
//Out puts a string containing the Registration Form
function DisplayRegistration(){
	$sslport=443;
	$register_url = "https://". $_SERVER['SERVER_NAME'] . ":" . $sslport ."/index.php?page=registration";
	$reg_form = '<form id="FormName" action="'.$register_url.'" method="post" name="registration">'. PHP_EOL;
	$reg_form .= '	<table class="data" border="0" cellpadding="0" cellspacing="0">'. PHP_EOL;
	$reg_form .= '		<tbody><tr class="roweven">'. PHP_EOL;
	$reg_form .= '			<th colspan="4">Registration Form</th>'. PHP_EOL;
	$reg_form .= '		</tr>'. PHP_EOL;
	$reg_form .= '		<tr class="roweven">'. PHP_EOL;
	$reg_form .= '			<td rowspan="17" valign="top"><strong>Lead Attendee</strong></td>'. PHP_EOL;
	$reg_form .= '			<td>First Name</td>'. PHP_EOL;
	$reg_form .= '			<td align="right"><span id="req">*</span></td>'. PHP_EOL;
	$reg_form .= '			<td>'. PHP_EOL;
	$reg_form .= '				<input name="first_name" size="24" type="text"></td>'. PHP_EOL;
	$reg_form .= '		</tr>'. PHP_EOL;
	$reg_form .= '		<tr class="roweven">'. PHP_EOL;
	$reg_form .= '			<td>Last Name</td>'. PHP_EOL;
	$reg_form .= '			<td align="right"><span id="req">*</span></td>'. PHP_EOL;
	$reg_form .= '			<td>'. PHP_EOL;
	$reg_form .= '				<input name="last_name" size="24" type="text"></td>'. PHP_EOL;
	$reg_form .= '		</tr>'. PHP_EOL;
	$reg_form .= '		<tr class="roweven">'. PHP_EOL;
	$reg_form .= '			<td>Company</td>'. PHP_EOL;
	$reg_form .= '			<td align="right"><span id="req">*</span></td>'. PHP_EOL;
	$reg_form .= '			<td>'. PHP_EOL;
	$reg_form .= '				<input name="company" size="24" type="text"></td>'. PHP_EOL;
	$reg_form .= '		</tr>'. PHP_EOL;
	$reg_form .= '		<tr class="roweven">'. PHP_EOL;
	$reg_form .= '			<td colspan="4" height="32">'. PHP_EOL;
	$reg_form .= '			</td>'. PHP_EOL;
	$reg_form .= '		</tr>'. PHP_EOL;
	$reg_form .= '		<tr class="roweven">'. PHP_EOL;
	$reg_form .= '			<td>Email</td>'. PHP_EOL;
	$reg_form .= '			<td align="right"><span id="req">*</span></td>'. PHP_EOL;
	$reg_form .= '			<td>'. PHP_EOL;
	$reg_form .= '				<input name="email" size="24" type="text"></td>'. PHP_EOL;
	$reg_form .= '		</tr>'. PHP_EOL;
	$reg_form .= '		<tr class="roweven">'. PHP_EOL;
	$reg_form .= '			<td>Confirm Email</td>'. PHP_EOL;
	$reg_form .= '			<td align="right"><span id="req">*</span></td>'. PHP_EOL;
	$reg_form .= '			<td>'. PHP_EOL;
	$reg_form .= '				<input name="email_confirm" size="24" type="text"></td>'. PHP_EOL;
	$reg_form .= '		</tr>'. PHP_EOL;
	$reg_form .= '		<tr class="roweven">'. PHP_EOL;
	$reg_form .= '			<td colspan="4" height="32">'. PHP_EOL;
	$reg_form .= '			</td>'. PHP_EOL;
	$reg_form .= '		</tr>'. PHP_EOL;
	$reg_form .= '		<tr class="roweven">'. PHP_EOL;
	$reg_form .= '			<td>Passoword</td>'. PHP_EOL;
	$reg_form .= '			<td align="right"><span id="req">*</span></td>'. PHP_EOL;
	$reg_form .= '			<td>'. PHP_EOL;
	$reg_form .= '				<input name="password_" size="24" type="password"></td>'. PHP_EOL;
	$reg_form .= '		</tr>'. PHP_EOL;
	$reg_form .= '		<tr class="roweven">'. PHP_EOL;
	$reg_form .= '			<td>Confirm Password</td>'. PHP_EOL;
	$reg_form .= '			<td align="right"><span id="req">*</span></td>'. PHP_EOL;
	$reg_form .= '			<td>'. PHP_EOL;
	$reg_form .= '				<input name="password_confirm" size="24" type="password"></td>'. PHP_EOL;
	$reg_form .= '		</tr>'. PHP_EOL;
	$reg_form .= '		<tr class="roweven">'. PHP_EOL;
	$reg_form .= '			<td colspan="4" height="32">'. PHP_EOL;
	$reg_form .= '			</td>'. PHP_EOL;
	$reg_form .= '		</tr>'. PHP_EOL;
	$reg_form .= '		<tr class="roweven">'. PHP_EOL;
	$reg_form .= '			<td>Phone Day</td>'. PHP_EOL;
	$reg_form .= '			<td align="right"><span id="req">*</span></td>'. PHP_EOL;
	$reg_form .= '			<td>(<input name="phone1_a" class="tel3" size="3" maxlength="3" type="text"> )'. PHP_EOL;  
	$reg_form .= '				<input name="phone1_b" class="tel3" size="3" maxlength="3" type="text"> -'. PHP_EOL;  
	$reg_form .= '				<input name="phone1_c" class="tel4" size="4" maxlength="4" type="text"> Ext'. PHP_EOL;  
	$reg_form .= '				<input name="phone1_d" class="tel3" size="3" maxlength="5" type="text"></td>'. PHP_EOL;
	$reg_form .= '		</tr>'. PHP_EOL;
	$reg_form .= '		<tr class="roweven">'. PHP_EOL;
	$reg_form .= '			<td>Phone Evening</td>'. PHP_EOL;
	$reg_form .= '			<td></td>'. PHP_EOL;
	$reg_form .= '			<td>(<input name="phone2_a" class="tel3" size="3" maxlength="3" type="text"> )  '. PHP_EOL;
	$reg_form .= '				<input name="phone2_b" class="tel3" size="3" maxlength="3" type="text"> -'. PHP_EOL;  
	$reg_form .= '				<input name="phone2_c" class="tel4" size="4" maxlength="4" type="text"> Ext'. PHP_EOL;  
	$reg_form .= '				<input name="phone2_d" class="tel3" size="3" maxlength="5" type="text"></td>'. PHP_EOL;
	$reg_form .= '		</tr>'. PHP_EOL;
	$reg_form .= '		<tr class="roweven">'. PHP_EOL;
	$reg_form .= '			<td>Address<br /><br /></td>'. PHP_EOL;
	$reg_form .= '			<td align="right"><span id="req">*</span><br /><br /></td>'. PHP_EOL;
	$reg_form .= '			<td>'. PHP_EOL;
	$reg_form .= '				<input name="address" size="24" type="text"><br />'. PHP_EOL;
	$reg_form .= '				<input name="address2" size="24" type="text"></td>'. PHP_EOL;
	$reg_form .= '		</tr>'. PHP_EOL;
	$reg_form .= '		<tr class="roweven">'. PHP_EOL;
	$reg_form .= '			<td>City</td>'. PHP_EOL;
	$reg_form .= '			<td align="right"><span id="req">*</span></td>'. PHP_EOL;
	$reg_form .= '			<td>'. PHP_EOL;
	$reg_form .= '				<input name="city" size="24" type="text"></td>'. PHP_EOL;
	$reg_form .= '		</tr>'. PHP_EOL;
	$reg_form .= '		<tr class="roweven">'. PHP_EOL;
	$reg_form .= '			<td>State</td>'. PHP_EOL;
	$reg_form .= '			<td align="right"><span id="req">*</span></td>'. PHP_EOL;
	$reg_form .= '			<td>' .PHP_EOL;
	$reg_form .=		StateSelect();
	$reg_form .= '			</td>'. PHP_EOL;
	$reg_form .= '		</tr>'. PHP_EOL;
	$reg_form .= '		<tr class="roweven">'. PHP_EOL;
	$reg_form .= '			<td>Zip</td>'. PHP_EOL;
	$reg_form .= '			<td align="right"><span id="req">*</span></td>'. PHP_EOL;
	$reg_form .= '			<td>'. PHP_EOL;
	$reg_form .= '				<input name="zip" size="24" type="text"></td>'. PHP_EOL;
	$reg_form .= '		</tr>'. PHP_EOL;
	$reg_form .= '		<tr class="roweven">'. PHP_EOL;
	$reg_form .= '			<td colspan="4" align="center" height="64"><button name="buttonName" value="Submit" type="submit">Confirm</button></td>'. PHP_EOL;
	$reg_form .= '		</tr>'. PHP_EOL;
	$reg_form .= '	</tbody></table>'. PHP_EOL;
	$reg_form .= '</form>'. PHP_EOL;

	return $reg_form;
}

//  This function does all of the form validation.
//  FAILS: 	If validation fails the returned array will contain index 0 
//  			and an index for each error with the form element names as keys
//  PASSES: 	An array of formatted form values will be returned for use with
//					the AddCustomer member function for the Customer class of the WSAPI 
function FormCheck(){
	$errors = array();
	$first_name = isset($_POST[first_name]) ?$_POST[first_name]: '';
	$last_name = isset($_POST[last_name]) ?$_POST[last_name]: '';
	$company = isset($_POST[company]) ?$_POST[company]: '';
	$email = isset($_POST[email]) ?$_POST[email]: '';
	$email_confirm  = isset($_POST[email_confirm] ) ?$_POST[email_confirm] : '';
	$password = isset($_POST[password_]) ? $_POST[password_]: '';
	$phone1_a  = isset($_POST[phone1_a]) ? $_POST[phone1_a]: '';
	$phone1_b  = isset($_POST[phone1_b]) ? $_POST[phone1_b]: '';
	$phone1_c  = isset($_POST[phone1_c]) ? $_POST[phone1_c]: '';
	$phone1_d  = isset($_POST[phone1_d]) ? $_POST[phone1_d]: '';
	$phone2_a  = isset($_POST[phone2_a]) ? $_POST[phone2_a]: '';
	$phone2_b  = isset($_POST[phone2_b]) ? $_POST[phone2_b]: '';
	$phone2_c  = isset($_POST[phone2_c]) ? $_POST[phone2_c]: '';
	$phone2_d  = isset($_POST[phone2_d]) ? $_POST[phone2_d]: '';
	$password_confirm = isset($_POST[password_confirm]) ?$_POST[password_confirm]: '';
	$address = isset($_POST[address]) ?$_POST[address]: '';
	$address2 = isset($_POST[address2]) ?$_POST[address2]: '';
	$city = isset($_POST[city]) ?$_POST[city]: '';
	$state = isset($_POST[state]) ?$_POST[state]: '';
	$zip = isset($_POST[zip]) ?$_POST[zip]: '';
	foreach($_POST as $key =>$entry){
		$search = array('confirm', '1_a', '1_b', '1_c', '1_d', '2_a', '2_b', '2_ c', '2_d','_');
		$replace = array('confirmation','','','','','','','','',' ');
		$field = str_replace($search,$replace, $key); 
		if(trim($entry) == '' && (($key !='phone1_d') && ($key !='address2') && ($key !='phone2_a') && ($key !='phone2_b') && ($key !='phone2_c') && ($key !='phone2_d')))
			$errors[$key] = "Please enter your $field";
	}
	
	if($password != $password_confirm && ($password != '' || $password_confirm != ''))
		$errors[password_] = "The passwords supplied do not match";
	if($email != $email_confirm && ($email != '' || $email_confirm != ''))
		$errors[email] = "The e-mail addresses supplied do not match";
	if(count($errors)<1){
		unset($errors);
		$form_vars = array();		
		$form_vars[first_name] = $first_name;
		$form_vars[last_name] = $last_name;
		$form_vars[address1] = $address2 != '' ? $address . ' '. $address2: $address;
		$form_vars[address2] = '';
		$form_vars[city] = $city;
		$form_vars[state] = $state;
		$form_vars[zip] =$zip;
		$form_vars[email] = $email;
		$form_vars[birthdate] = '';
		$form_vars[gender] ='';
		$form_vars[phone] = $phone1_d != '' ? $phone1_a.$phone1_b.$phone1_c.$phone1_d: $phone1_a.$phone1_b.$phone1_c;
		$form_vars[company] = $company;
		$form_vars[fax] = $phone2_d != '' ? $phone2_a.$phone2_b.$phone2_c.$phone2_d: $phone2_a.$phone2_b.$phone2_c;
		$form_vars[phone2] = '';
		$form_vars[password] = $password;	
		return $form_vars;
	}
	else{
		$errors[0] = "ERRORS"; 
		return $errors;
	}
}
/*
echo '<pre>';
print_r($_SESSION);
print_r($_COOKIE);
echo '</pre>';
*/
//  If the form was submited... 
if(isset($_POST[buttonName])){
	//  Validate Form
	$form_vars = FormCheck();
	//  IF no errors were found
	if(!isset($form_vars[0])){
		$url = "https://". $_SERVER['SERVER_NAME'] . "/freeway/custom/webservices/index.php?service=Customer";
		$Client = new SoapClient($url);
		$Client->__setCookie('ws_freeway', $this_Session);
		$newCustomer = $Client->AddCustomer($form_vars[first_name],$form_vars[last_name],$form_vars[address1],$form_vars[address2],$form_vars[city],$form_vars[state],$form_vars[zip],$form_vars[email],$form_vars[email2],$form_vars[birthdate],$form_vars[gender],$form_vars[phone],$form_vars[company],$form_vars[fax],$form_vars[phone2],$form_vars[password]);
		//echo '<pre>';		
		//print_r($newCustomer);
		//echo '</pre>';	
		unset($form_vars);
		if(isset($newCustomer[0])){
			$_SESSION['cart']['customer_id'] = $newCustomer[0];
		}
	}
	else{
	//print_r($form_vars);
	//print_r($form_vars[0]);
	//  If errors were found
	    //  Get the form 
		$form_corrections = DisplayRegistration();
		//  Loop through each of the posted values
		foreach($_POST as $key => $value){
			//  Check for any errors
			if(array_key_exists($key, $form_vars)){
				$message = $form_vars[$key];
				//  Attached the error message to the form 
				if($key != "phone1_b" && $key != "phone1_c" && $key != "phone1_a")
					$form_corrections =str_replace("<input name=\"$key\"", "<em style=\"color: #B54639\">$message</em><br />"."<input name=\"$key\" value=\"$value\" ",$form_corrections);
				//  This special case needs different formatting
				elseif($key == "phone1_a")
					$form_corrections =str_replace(	"(<input name=\"$key\"","<em style=\"color: #B54639\">$message</em><br />"."(<input name=\"$key\" value=\"$value\" ",$form_corrections);
			}			
			else{
				//  If no error was found attached the submitted value to the form input
				$form_corrections = str_replace("name=\"$key\"", "name=\"$key\" value=\"$value\" ", $form_corrections);
				// also select any options that were selected... 
				$form_corrections = str_replace("<option value=\"$value\">", "<option value=\"$value\" selected>", $form_corrections);
			}					
		}
	}
}
//  If the customer was successfully added
if(isset($_SESSION['cart']['customer_id'])){
	unset($Client);
	$url_cart = "https://". $_SERVER['SERVER_NAME'] . "/freeway/custom/webservices/index.php?service=ShoppingCart";
	$Cart = new SoapClient($url_cart);
	$Cart->__setCookie('ws_freeway', $this_Session);
	$Cart->__setCookie('customer_id', $_SESSION[cart][customer_id]);
	$cart_contents = $Cart->getCustomerCart();
	//print_r($cart_contents);
	//print_r($_SESSION['cart']['customer_id']);
	$count = 0;
	$total = 0;
	$startTable =	'<h3>Your Cart</h3><table class="data" border="0" cellspacing="0" cellpadding="0">' .PHP_EOL;
	$startTable .= '<tr>' .PHP_EOL;
	$startTable .= '<th nowrap="nowrap" colspan="2">Course</th>' .PHP_EOL;
	$startTable .= '<th nowrap="nowrap" colspan="2">Date</th>' .PHP_EOL;
	$startTable .= '<th nowrap="nowrap" colspan="2">Location</th>' .PHP_EOL;
	$startTable .= '<th nowrap="nowrap" colspan="2">Qty</th>' .PHP_EOL;
	$startTable .= '<th nowrap="nowrap" colspan="2">Price</th>' .PHP_EOL;
	$startTable .= '<th nowrap="nowrap" colspan="2" align="left">Total</th>' .PHP_EOL;
	$startTable .= '</tr><tbody>';
	echo $startTable;
	foreach ($cart_contents["cart"] as $event){
		$row_type = ($count++ % 2 == 0) ? 'roweven': 'rowodd';
		$dates = explode(',',strip_tags($event[events_description]));
		$start = strip_tags(trim(str_replace('&nbsp;', '', $dates[0])));
		$end = strip_tags(trim(str_replace('&nbsp;', '', $dates[1])));
		$range = str_replace('&nbsp;', '', $start . ' - ' . $end);
		$range = trim($range);
		$price = "$".money_format('%i', $event[events_fees]);
		$row_sum = 
		$total = (int)$total + (int)$event[events_fees]*$event[qnty]; 
		$location = explode(',', $event[location_name]);
		$location1 = $location[0];
		$location2 = $location[1];
		$url = 'https://eden.iwsdev.com/training';
		$title = $event[events_categories_name];
		$qnty = $event[qnty];
		$row_sum = "$".money_format('%i', ($event[events_fees]*$event[qnty]));
		$register_url = 'https://'. $_SERVER['SERVER_NAME'] . '/register-course?item='.$event[events_id].'&session='.$event[sessions_id];
		
		$display = "<tr class=".$row_type.">" .PHP_EOL;
		$display .= "<td colspan=\"2\">$title</td>" .PHP_EOL;
		$display .= "<td colspan=\"2\">$range</td>" .PHP_EOL;
		$display .= "<td colspan=\"2\"><a href=".$url.">$location1,&nbsp;$location2</a></td>" .PHP_EOL;
		$display .= "<td colspan=\"2\"><input name=\"textfieldName\" value=\"$qnty\" size=\"2\" type=\"text\" width=\"24\"/></td>" .PHP_EOL;
		$display .= "<td colspan=\"2\" align=\"right\">$price</td>" .PHP_EOL;
		$display .= "<td colspan=\"2\" align=\"right\">$row_sum</td>" .PHP_EOL;
		$display .= "</tr>" .PHP_EOL;

		echo $display;
	}
	$total = "$".money_format('%i', $total);	
	$EndTable ='	<tr class="roweven">' .PHP_EOL;
	$EndTable .='		<td colspan="11"><a href="'.$url.'">Register more courses...</a></td>' .PHP_EOL;
	$EndTable .='	</tr>' .PHP_EOL;
	$EndTable .='	<tr class="roweven">' .PHP_EOL;
	$EndTable .='		<td colspan="9" align="right"><strong>Sub Total</strong></td>' .PHP_EOL;
	$EndTable .='		<td></td>' .PHP_EOL;
	$EndTable .='		<td align="right"><strong>'.$total.'</strong></td>' .PHP_EOL;
	$EndTable .='	</tr>' .PHP_EOL;

	echo $EndTable .'</tbody></table>';
}
elseif(isset($form_corrections)){
	//  If the form wasn't filled out correctly alert user
	echo $form_corrections;
	unset($form_corrections);
}
elseif(!isset($newCustomer[Error])){
	//  Display the Registration form
	unset($Client);
	echo DisplayRegistration();
}
else{
	//  The e-mail was previously registered so prompt for a login or register another e-mail address
	unset($Client);
	$registration_url = '/index.php?page=registration';
	$login_action_url ='/index.php?page=cart-login';
	$login_form  = '<form id="login" method="post" action="'.$login_action_url.'" enctype="multipart/form-data" style="margin: 8px; text-align: left; float: left;">';
	$login_form .= '<div class="formbuilder" style="margin: 8px; text-align: left; float: left;"><div class="required text2-0">';
	$login_form .= '		<label for="email">E-mail: <span class="required_symbol">*</span></label>';
	$login_form .= '		<input type="text" name="email" id="email" value="'.$form_vars[email].'" size="25" maxlength="128" />';
	$login_form .= '	</div>';
	$login_form .= '	<div class="required text2-0">';
	$login_form .= '		<label for="password">Password: <span class="required_symbol">*</span></label>';
	$login_form .= '		<input type="password" name="password" id="password" value="" size="25" maxlength="128" />';
	$login_form .= '	</div>';
	$login_form .= '	<div class="submit">';
	$login_form .= '	<script type="text/javascript">';
	$login_form .= '	/* <!-- <![CDATA[ */';
	$login_form .= '    var submitted = 0;';
	$login_form .= '    function LockButton ()';
	$login_form .= '       {';
	$login_form .= '       var ret = false;';
	$login_form .= '       if ( ! submitted )';
	$login_form .= '          {';
	$login_form .= '           var item = document.getElementById("fbsubmit");';
	$login_form .= '           if (item != null)';
	$login_form .= '             {';
	$login_form .= '             setTimeout(function() {item.disabled = true}, 0);';
	$login_form .= '             }';
	$login_form .= '           submitted = 1;';
	$login_form .= '           ret = true;';
	$login_form .= '          }';
	$login_form .= '        return ret;';
	$login_form .= '        }';
	$login_form .= '    /* ]]> --> */';    
	$login_form .= '	</script><input name="submit" value="Login" type="submit" class="fbsubmit" id="fbsubmit" onclick="return LockButton()" />';
	$login_form .= '</div>';
	$login_form .= '</div>';
	$login_form .= '</form>';
	echo "<h3>$newCustomer[Error]</h3>";
	echo '<h3>You can login or <a href="'.$registration_url.'" >register</a> with a different e-mail address.</h3>';
	echo $login_form;
}
/*
print_r($form_vars);
print_r($form_vars[0]);
print_r($newCustomer);
*/

?>